import 'package:logger/logger.dart';

class MyLog {
  static bool _isDebug = true;

  MyLog._internal();

  static void init({bool isDebug = false, Logger? loggerNoStack}) {
    _isDebug = isDebug;
    if (_logger == null) {
      _logger = Logger(
        printer: PrettyPrinter(),
      );
    }
    if (loggerNoStack != null) {
      _loggerNoStack = loggerNoStack;
    }
  }

  static Logger? _logger;

  //Logger(
  //     printer: PrettyPrinter(methodCount: 0),
  //   );
  static Logger? _loggerNoStack;

  static void d(String s) {
    if (_isDebug) _logger!.d(s);
  }

  static void e(String s) {
    if (_isDebug) _logger!.e(s);
  }

  static void i(String s) {
    if (_isDebug) _logger!.i(s);
  }

  static void w(String s) {
    if (_isDebug) _logger!.w(s);
  }

  static void v(String s) {
    if (_isDebug) _logger!.v(s);
  }
}

class MyFilter extends LogFilter {
  @override
  bool shouldLog(LogEvent event) {
    return true;
  }
}
